package com.core.admin.action.service;

import org.apache.commons.lang.StringUtils;

import com.common.web.BaseWebMessage;

public class WebMessage extends BaseWebMessage{

	public  final String PAGE = "common/message";

	public static final String MESSAGE_ATTR_NAME = "messages";
	
	public static final String ERROR_ATTR_NAME="errors";
	
	WebMessage(){}
	
	WebMessage(String input){
		this.input=input;
	}
	
	private String input;
	@Override
	protected String getErrorAttrName() {

		return MESSAGE_ATTR_NAME;
	}

	@Override
	public String getPage() {
		if(StringUtils.isNotBlank(input))
			return input;
		return PAGE;
	}
	
	public static WebMessage create(){
		return new WebMessage();
	}
	public static WebMessage create(String input){
		return new WebMessage(input);
	}
	@Override
	protected String getMSGAttrName() {
		return ERROR_ATTR_NAME;
	}

}
